﻿/**
 * NoCacheUrl Class
 * Copyright (c) 2009 designmarco
 * @author Marco Di Giuseppe  |  http://designmarco.com
 * marco[at]designmarco[dot]com
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package com.designmarco.utils
{
/**
 * NoCacheUrl can guard any number of urls from being cached.
 * @example
  <code>import com.designmarco.utils.NoCacheUrl; <br />
		var links:Array = ["link1.html", "link2.html", "link3.html"]; <br />
		trace(NoCacheUrl.guard(links));</code>
 */
	public class NoCacheUrl
	{
		/**
		 * Protects and Returns an array of urls that will not be cached.
		 * @usage NoCacheUrl.guard(["linkA.html, "linkB.html", "linkC.html"]);
		 * @param urlArray - group of url strings to be protected
		 * @return
		 */
		public static function guard(urlArray:Array):Array
		{
			var i:int = urlArray.length;
			while(i--)
			{
				urlArray[i] += "?ikillcache" + new Date().getTime();
			}
			return urlArray;
		}
	}
}
